--
-- Created by IntelliJ IDEA.
-- User: wp
-- Date: 2018/12/6
-- Time: 上午11:11
-- To change this template use File | Settings | File Templates.
--
local table_insert = table.insert
DelayCacheMgr = {}
DelayCacheMgr.DelayConstant = {
    GetPartner = "GetPartner",
    GetMount = "GetMount",
}

DelayCacheMgr._delayCache = {}

function DelayCacheMgr.registerDelayMsg(str, func, params)
    local lockFuns = DelayCacheMgr._delayCache[str]
    if lockFuns then
        table_insert(lockFuns,{func = func, params = params})
    else
        --可能要立马执行
        executeFunc(func,params)
    end
end

function DelayCacheMgr.lock(str)
    local lockFuns = DelayCacheMgr._delayCache[str]
    if not lockFuns then
        DelayCacheMgr._delayCache[str] = {}
    end
end

function DelayCacheMgr.unLock(str)
    local lockFuns = DelayCacheMgr._delayCache[str]
    if lockFuns then
        for k,v in ipairs(lockFuns) do
            executeFunc(v.func,v.params)
        end
        DelayCacheMgr._delayCache[str] = nil
    end
end